{*
T1为T的升级版本,主要是将js剥离出来了。
注意:
proKind为产品弹出选择控件的必须参考的元素,特里特个性化需求,出了订单登记界面外其他使用产品弹出选择控件的模板必须制定proKind为hidden控件
*}<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{$title}</title>
</head>
<link href="Resource/Css/validate.css" type="text/css" rel="stylesheet">
<link rel="stylesheet" href="Resource/bootstrap/bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="Resource/bootstrap/bootstrap/css/bootstrap_eqinfo.css">
{webcontrol type='LoadJsCss' src="Resource/Css/scrollbar.css"}
{webcontrol type='LoadJsCss' src="Resource/ext/include-ext.js"}
{webcontrol type='LoadJsCss' src="Resource/ext/TabCloseMenu.js"}
{webcontrol type='LoadJsCss' src="Resource/Script/jquery.1.9.1.js"}
{webcontrol type='LoadJsCss' src="Resource/bootstrap/bootstrap/js/bootstrap.js"}
{webcontrol type='LoadJsCss' src="Resource/Script/ymPrompt/ymPrompt.js"}
{webcontrol type='LoadJsCss' src="Resource/Css/alertify.default.css"}
{webcontrol type='LoadJsCss' src="Resource/Css/alertify.core.css"}
{webcontrol type='LoadJsCss' src="Resource/Css/alertify.bootstrap.css"}
{webcontrol type='LoadJsCss' src="Resource/Script/alertify/alertify.js"}

<body>
<!--   <h2>Dialogs</h2>
  <a href="#" id="alert">Alert Dialog</a><br>
  <a href="#" id="confirm">Confirm Dialog</a><br>
  <a href="#" id="prompt">Prompt Dialog</a><br>
  <a href="#" id="labels">Custom Labels</a><br>
  <a href="#" id="focus">Button Focus</a><br>
  <a href="#" id="order">Button Order</a>

  <h2>Ajax</h2>
  <a href="#" id="ajax">Ajax - Multiple Dialog</a>

  <h2>Logs</h2>
  <a href="#" id="notification">Standard Log</a><br>
  <a href="#" id="success">Success Log</a><br>
  <a href="#" id="error">Error Log</a><br>
  <a href="#" id="custom">Custom Log</a><br>
  <a href="#" id="delay">Hide in 10 seconds</a><br>
  <a href="#" id="forever">Persistent Log</a>

  <h2>Themes</h2>
  <a href="#" id="bootstrap">Bootstrap Theme</a> -->
<form name="form1" id="form1" class="form-horizontal" action="{url controller=$smarty.get.controller action=$action_save|default:'Save'}" method="post" {if $form.upload==true}enctype="multipart/form-data"{/if}>

<!-- 主表字段登记区域 -->
<div class="panel panel-default">
  <div class="panel-heading"><h3 class="panel-title" style="text-align:left;">{$areaMain.title}</h3></div>
  <div class="panel-body">
    <div class="row">
      {foreach from=$areaMain.fld item=item key=key}
      {include file="Main2Son/"|cat:$item.type|cat:".tpl"}
      {/foreach}
    </div>       
    <!-- <a href="#" id="bootstrap">alert</a>
    <a href="#" id="alert">Alert Dialog</a><br>
    <a href="#" id="confirm">Confirm Dialog</a><br>
    <a href="#" id="prompt">Prompt Dialog</a><br>
    <a href="#" id="labels">Custom Labels</a><br>
    <a href="#" id="focus">Button Focus</a><br>
    <a href="#" id="order">Button Order</a>
    <a href="#" id="ajax">Ajax - Multiple Dialog</a>
    <a href="#" id="notification">Standard Log</a><br>
    <a href="#" id="success">Success Log</a><br>
    <a href="#" id="error">Error Log</a><br>
    <a href="#" id="custom">Custom Log</a><br>
    <a href="#" id="delay">Hide in 10 seconds</a><br>
    <a href="#" id="forever">Persistent Log</a>
   -->
  </div>
</div>

<div class="panel panel-default">
<div class="panel-heading">
  <h3 class="panel-title" style="text-align:left;">{$sonTitle|default:'明细信息'}</h3>
</div>
<div class="panel-body" style="overflow:auto;max-height:320px;">
  <div class="table-responsive1" style="margin-top:-15px;">
  <table class="table table-condensed table-striped" id='table_main'>
    <thead>
      <tr>
        {assign var=i value=0}
        {foreach from=$headSon item=item key=key}
        {assign var=i value=$i+1}
        {if $item.type!='BtHidden'}
          {*如果是第一列,判断$firstColumn.head,再判断是否btnRemove*}
          {if $i==1}
            {*如果有特殊表头信息，需要加载特殊表头信息*}
            {if $firstColumn.head}
              {if $firstColumn.head.type}
                <th>{webcontrol type=$firstColumn.head.type title=$firstColumn.head.title url=$firstColumn.head.url}</th>
              {else}
                <th style='white-space:nowrap;'>{$firstColumn.head.title}</th>
              {/if}
            {elseif $item.type=='BtBtnRemove'}{*不存在表头信息，处理默认的信息*}
              <th>{webcontrol type='BtBtnAdd'}</th>
            {else}
              <th style='white-space:nowrap;'>{$item.title}</th>
            {/if}
          {else}
              <th style='white-space:nowrap;' {if $item.colmd>0}class="col-md-{$item.colmd}"{/if}>{$item.title}</th>
          {/if}  
        {/if}
        {/foreach}
      </tr>   
    </thead>
    <tbody>
      {foreach from=$rowsSon item=item1 key=key1}
      <tr class='trRow'>
        {foreach from=$headSon item=item key=key}
          {if $item.type!='BtHidden'}
          <td width="100px">{webcontrol 
                  type=$item.type
                  value=$item1[$key].value
                  kind=$item.kind
                  itemName=$item.name
                  readonly=$item.readonly
                  disabled=$item.disabled
                  model=$item.model
                  options=$item.options
                  optsSon=$item1[$key].optsSon
                  optionType=$item.optionType
                  checked=$item1[$key].checked
                  url=$item.url 
                  textFld=$item.textFld
                  hiddenFld=$item.hiddenFld
                  text=$item1[$key].text
                  inTable=$item.inTable 
                  condition=$item.condition
                  dialogWidth=$item.dialogWidth 
                  width=$item.width
                  style=$item.style
                  title=$item.title
                  tip=$item.tip
          }</td>
          {else}
            {webcontrol type=$item.type value=$item1[$key].value itemName=$item.name readonly=$item.readonly disabled=$item.disabled}
          {/if}
        {/foreach}
      </tr>  
      {/foreach}    
    </tbody>
  </table>
</div>
</div>
</div>

{foreach from=$bottomSon item=item key=key}
  <div class="col-xs-4">
    <div class="form-group">
        <label for="{$item.name|default:$key}" class="col-sm-3 control-label lableMain lableMain">{$item.title}:</label>
        <div class="col-sm-9">
          {webcontrol type='BtText' itemName=$item.name|default:$key value=$item.value disabled=$item.disabled readonly=$item.readonly addonPre=$item.addonPre addonEnd=$item.addonEnd width=$item.width}
        </div>
    </div>
  </div>
{/foreach}

{if $otherInfoTpl!=''}
{include file=$otherInfoTpl}
{/if}
{if $qitaInfoTpl!=''}
{include file=$qitaInfoTpl}
{/if}
<div class="form-group col-xs-12">
  <div class="text-center btnSubmit">
      <input class="btn btn-info" type="submit" id="Submit" name="Submit" value=" 保存(Alt+S)" accesskey="S" onclick="$('#submitValue').val('保存')">
      {*其他一些功能按钮,*}
      {$other_button}
      {*<input class="btn btn-default" type="reset" id="Reset" name="Reset" value=" 重 置 ">*}
      <input type='hidden' name='submitValue' id='submitValue' value=''/>
      <input type='hidden' name='fromController' id='fromController' value='{$fromController|default:$smarty.get.controller}'/>
      <input type='hidden' name='fromAction' id='fromAction' value='{$fromAction|default:$smarty.get.fromAction}'/>
  </div>
</div>
<div style="clear:both;"></div>
</form>

  {literal}
  <script>
    function reset () {
      // $("#toggleCSS").attr("href", "../themes/alertify.default.css");
      alertify.set({
        labels : {
          ok     : "OK",
          cancel : "Cancel"
        },
        delay : 5000,
        buttonReverse : true,
        buttonFocus   : "ok"
      });
    }

    // ==============================
    // Standard Dialogs
    $("#alert").on( 'click', function () {
      reset();
      alertify.alert("This is an alert dialog");
      return false;
    });

    $("#confirm").on( 'click', function () {
      reset();
      alertify.confirm("This is a confirm dialog", function (e) {
        if (e) {
          alertify.success("You've clicked OK");
        } else {
          alertify.error("You've clicked Cancel");
        }
      });
      return false;
    });

    $("#prompt").on( 'click', function () {
      reset();
      alertify.prompt("This is a prompt dialog", function (e, str) {
        if (e) {
          alertify.success("You've clicked OK and typed: " + str);
        } else {
          alertify.error("You've clicked Cancel");
        }
      }, "Default Value");
      return false;
    });

    // ==============================
    // Ajax
    $("#ajax").on("click", function () {
      reset();
      alertify.confirm("Confirm?", function (e) {
        if (e) {
          alertify.alert("Successful AJAX after OK");
        } else {
          alertify.alert("Successful AJAX after Cancel");
        }
      });
    });

    // ==============================
    // Standard Dialogs
    $("#notification").on( 'click', function () {
      reset();
      alertify.log("Standard log message");
      return false;
    });

    $("#success").on( 'click', function () {
      reset();
      alertify.success("Success log message");
      return false;
    });

    $("#error").on( 'click', function () {
      reset();
      alertify.error("Error log message");
      return false;
    });

    // ==============================
    // Custom Properties
    $("#delay").on( 'click', function () {
      reset();
      alertify.set({ delay: 10000 });
      alertify.log("Hiding in 10 seconds");
      return false;
    });

    $("#forever").on( 'click', function () {
      reset();
      alertify.log("Will stay until clicked", "", 0);
      return false;
    });

    $("#labels").on( 'click', function () {
      reset();
      alertify.set({ labels: { ok: "Accept", cancel: "Deny" } });
      alertify.confirm("Confirm dialog with custom button labels", function (e) {
        if (e) {
          alertify.success("You've clicked OK");
        } else {
          alertify.error("You've clicked Cancel");
        }
      });
      return false;
    });

    $("#focus").on( 'click', function () {
      reset();
      alertify.set({ buttonFocus: "cancel" });
      alertify.confirm("Confirm dialog with cancel button focused", function (e) {
        if (e) {
          alertify.success("You've clicked OK");
        } else {
          alertify.error("You've clicked Cancel");
        }
      });
      return false;
    });

    $("#order").on( 'click', function () {
      reset();
      alertify.set({ buttonReverse: true });
      alertify.confirm("Confirm dialog with reversed button order", function (e) {
        if (e) {
          alertify.success("You've clicked OK");
        } else {
          alertify.error("You've clicked Cancel");
        }
      });
      return false;
    });

    // ==============================
    // Custom Log
    $("#custom").on( 'click', function () {
      reset();
      alertify.custom = alertify.extend("custom");
      alertify.custom("I'm a custom log message");
      return false;
    });

    // ==============================
    // Custom Themes
    $("#bootstrap").on( 'click', function () {
      reset();
      // $("#toggleCSS").attr("href", "../themes/alertify.bootstrap.css");
      alertify.prompt("Prompt dialog with bootstrap theme", function (e) {
        if (e) {
          alertify.success("You've clicked OK");
        } else {
          alertify.error("You've clicked Cancel");
        }
      }, "Default Value");
      return false;
    });
  </script>

{/literal}

{*通用的js代码放在_jsCommon中,主要是一些组件的效果*}
{include file='Main2Son/_jsCommon.tpl'}

{*下面是个性化的js代码,和特殊的业务逻辑挂钩,比如某些模板中自动合计的效果等*}
{if $sonTpl}
  {if $sonTpl|@is_string==1}
    {include file=$sonTpl}
  {else}
    {foreach from=$sonTpl item=js_item}
      {include file=$js_item}
    {/foreach}
  {/if}
{/if}
</body>
</html>